/**
 * 
 */
package com.jie.eclipse.pan.swtitem.widgets;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.wst.xml.ui.internal.properties.StringComboBoxCellEditor;

/**
 * @author yanjie
 *
 */
public class PanStringComboBoxCellEditor extends StringComboBoxCellEditor{
	private Map data = null;
	private List valueList = null;
	/**
	 * 
	 */
	public PanStringComboBoxCellEditor(Composite parent, String[] items, int style) {
		super(parent, items, style);
		this.valueList = new ArrayList();
	}
	
	public void setData(Object key,Object value){
		if(this.data ==null)this.data = new HashMap();
		this.data.put(key, value);
	}
	
	public Object getDate(Object key){
		if(this.data ==null)return null;
		return this.data.get(key);
	}
	
	/* (non-Javadoc)
	 * @see org.eclipse.wst.xml.ui.internal.properties.StringComboBoxCellEditor#doSetValue(java.lang.Object)
	 */
//	@Override
//	protected void doSetValue(Object tempvalue) {
//		Object object = null;
//		if(this.data != null){
//			Iterator it = this.data.keySet().iterator();
//			while(it.hasNext()){
//				Object key = it.next();
//				if(tempvalue == this.data.get(key)){
//					object = key;
//					break;
//				}
//			}
//		}
//		if(object != null)
//			super.doSetValue(object);
//	}
//	
//	@Override
	protected Object doGetValue() {
		this.valueList.clear();
		Object key = super.doGetValue();
		this.valueList.add(key);
		this.valueList.add(this.getDate(key));
		return this.valueList.toArray();
	}
}
